package com.hzj.recipe.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 食谱表
 * @TableName recipe
 */
@TableName(value ="recipe")
@Data
public class Recipe implements Serializable {
    /**
     * 食谱id
     */
    @TableId(value = "recipe_id")
    private Integer recipeId;

    /**
     * 分类id
     */
    @TableField(value = "category_id")
    private Integer categoryId;

    /**
     * 食谱封面
     */
    @TableField(value = "recipe_cover")
    private String recipeCover;

    /**
     * 食谱名称
     */
    @TableField(value = "recipe_name")
    private String recipeName;

    /**
     * 简介
     */
    @TableField(value = "recipe_description")
    private String recipeDescription;

    /**
     * 难度
     */
    @TableField(value = "recipe_difficulty")
    private Integer recipeDifficulty;

    /**
     * 收藏数
     */
    @TableField(value = "recipe_collect_num")
    private Integer recipeCollectNum;

    /**
     * 点赞数
     */
    @TableField(value = "recipe_enjoy_num")
    private Integer recipeEnjoyNum;

    /**
     * 创建时间
     */
    @TableField(value = "created_time")
    private LocalDateTime createdTime;

    /**
     * 修改时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Recipe other = (Recipe) that;
        return (this.getRecipeId() == null ? other.getRecipeId() == null : this.getRecipeId().equals(other.getRecipeId()))
            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
            && (this.getRecipeCover() == null ? other.getRecipeCover() == null : this.getRecipeCover().equals(other.getRecipeCover()))
            && (this.getRecipeName() == null ? other.getRecipeName() == null : this.getRecipeName().equals(other.getRecipeName()))
            && (this.getRecipeDescription() == null ? other.getRecipeDescription() == null : this.getRecipeDescription().equals(other.getRecipeDescription()))
            && (this.getRecipeDifficulty() == null ? other.getRecipeDifficulty() == null : this.getRecipeDifficulty().equals(other.getRecipeDifficulty()))
            && (this.getRecipeCollectNum() == null ? other.getRecipeCollectNum() == null : this.getRecipeCollectNum().equals(other.getRecipeCollectNum()))
            && (this.getRecipeEnjoyNum() == null ? other.getRecipeEnjoyNum() == null : this.getRecipeEnjoyNum().equals(other.getRecipeEnjoyNum()))
            && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRecipeId() == null) ? 0 : getRecipeId().hashCode());
        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
        result = prime * result + ((getRecipeCover() == null) ? 0 : getRecipeCover().hashCode());
        result = prime * result + ((getRecipeName() == null) ? 0 : getRecipeName().hashCode());
        result = prime * result + ((getRecipeDescription() == null) ? 0 : getRecipeDescription().hashCode());
        result = prime * result + ((getRecipeDifficulty() == null) ? 0 : getRecipeDifficulty().hashCode());
        result = prime * result + ((getRecipeCollectNum() == null) ? 0 : getRecipeCollectNum().hashCode());
        result = prime * result + ((getRecipeEnjoyNum() == null) ? 0 : getRecipeEnjoyNum().hashCode());
        result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", recipeId=").append(recipeId);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", recipeCover=").append(recipeCover);
        sb.append(", recipeName=").append(recipeName);
        sb.append(", recipeDescription=").append(recipeDescription);
        sb.append(", recipeDifficulty=").append(recipeDifficulty);
        sb.append(", recipeCollectNum=").append(recipeCollectNum);
        sb.append(", recipeEnjoyNum=").append(recipeEnjoyNum);
        sb.append(", createdTime=").append(createdTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}